let mostHitsApp = new Vue({
    el: '#mostHitsApp',
    data: {
        questions: [
            {id: 1,title: '第1个问题',statusText: '已解决',statusClass: 'text-success',hits: 852},
            {id: 2,title: '第2个问题',statusText: '未解决',statusClass: 'text-info',hits: 532},
            {id: 3,title: '第3个问题',statusText: '未回复',statusClass: 'text-warning',hits:134}
        ]
    },
    methods: {
        loadMostHitsList: function(){
            //alert('准备加载热点问题列表.....');
            $.ajax({
                url: '/api-question/v1/question/most-hits',
                success: function(r){
                    let list = r.data;
                    let statusTexts = ['未回复','已回复','已解决'];
                    let statusClasses = ['text-warning','text-info','text-success'];
                    for(let i = 0;i < list.length; i++){
                        list[i].statusText = statusTexts[list[i].status];
                        list[i].statusClass = statusClasses[list[i].status];
                    }
                    mostHitsApp.questions = list;
                }
            });
        }
    },
    created: function(){
        this.loadMostHitsList();
    }
});